<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <#include "../common/header.ftl">
    <script>
        $(function () {
           $('.inputBtn').click(function () {
               //回显数据 没有新增不需要清空
               var obj = $(this).data('json');
               $('#traceHistoryForm input[name="id"]').val(obj.id);
               $('#traceHistoryForm input[name="name"]').val(obj.name);
               $('#traceHistoryForm input[name="traceTime"]').val(obj.traceTime);
               $('#traceHistoryForm input[name="traceDetails"]').val(obj.traceDetails);
               $('#traceHistoryForm select[name="traceType.id"]').val(obj.traceTypeId);
               $('#traceHistoryForm select[name="traceResult"]').val(obj.traceResult);
               $('#traceHistoryForm textarea[name="remark"]').html(obj.remark);

               $("#inputModal").modal('show');
           });

           $(".inputSubmit").click(function () {
               $("#traceHistoryForm").submit();
           });

           //使用日历插件
            $('.date').click(function () {
                WdatePicker({
                    readOnly:true,
                    maxDate:new Date()
                });
            });
        });
    </script>
</head>
<body>

<div class="container " style="margin-top: 20px">
    <#include "../common/top.ftl">
    <div class="row">
        <div class="col-sm-3">
            <#include "../common/menu.ftl">
        </div>
        <div class="col-sm-9">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">跟进历史查询</h1>
                </div>
            </div>
            <#--高级查询--->
            <form class="form-inline" id="searchForm" action="/customerTraceHistory/list.do" method="post">
                <input type="hidden" name="currentPage" id="currentPage" value="1">
                <div class="form-group">
                    <label>关键字:</label>
                    <input type="text" class="form-control" name="keyword" value="${(qo.keyword)!}" placeholder="请输入姓名/电话">
                </div>
                <button id="btn_query" class="btn btn-default">
                    <span class="glyphicon glyphicon-search"></span> 查询
                </button>
            </form>

            <table class="table table-striped table-hover" >
                <tr>
                    <th>编号</th>
                    <th>客户姓名</th>
                    <th>跟进时间</th>
                    <th>跟进记录</th>
                    <th>跟进方式</th>
                    <th>跟进结果</th>
                    <th>录入人</th>
                    <th>操作</th>
                </tr>
                <#list pageInfo.list as entity>
                    <tr>
                        <td>${entity_index+1}</td>
                        <td>${entity.customer.name}</td>
                        <td>${entity.traceTime?string("y-M-d")}</td>
                        <td>${entity.traceDetails}</td>
                        <td>${entity.traceType.title}</td>
                        <td>${entity.traceResultName}</td>
                        <td>${entity.inputUser.name}</td>
                        <td>
                            <a href="javascript:" class="btn btn-info btn-xs inputBtn" data-json='${entity.json}'>
                                <span class="glyphicon glyphicon-pencil"></span> 编辑
                            </a>
                        </td>
                    </tr>
                </#list>
            </table>
            <div style="text-align: center;">
                <#include "../common/page.ftl">
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="inputModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">编辑</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="/customerTraceHistory/saveOrUpdate.do" method="post" id="traceHistoryForm">
                    <input type="hidden" name="id"/>
                    <div class="form-group" >
                        <label class="col-lg-4 control-label">客户姓名：</label>
                        <div class="col-lg-6">
                            <input type="text" class="form-control" readonly name="name"/>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="col-lg-4 control-label">跟进时间：</label>
                        <div class="col-lg-6">
                            <input type="text" class="form-control date" name="traceTime"
                                   placeholder="请输入跟进时间"/>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="col-lg-4 control-label">跟进记录：</label>
                        <div class="col-lg-6">
                            <input type="text" class="form-control" name="traceDetails"
                                   placeholder="请输入跟进记录"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">交流方式：</label>
                        <div class="col-lg-6">
                            <select class="form-control" name="traceType.id">
                                <#list cms as c>
                                    <option value="${c.id}">${c.title}</option>
                                </#list>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">跟进结果：</label>
                        <div class="col-lg-6">
                            <select class="form-control" name="traceResult">
                                <option value="3">优</option>
                                <option value="2">中</option>
                                <option value="1">差</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="col-lg-4 control-label">备注：</label>
                        <div class="col-lg-6">
                            <textarea type="text" class="form-control" name="remark"></textarea>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary inputSubmit">保存</button>
            </div>
        </div>
    </div>
</div>
</body>
</html>